import * as io from 'socket.io-client'
import Vue from 'Vue'

export interface Client{
    on: (event:string, cb:Function)=>void
    emit: (event:string, cb:Function)=>void
}

export class Socket{

    // 连接对象
    public socket:Client|undefined
    

    // 连接服务器
    public connect(token:string){
        this.socket = io('http://127.0.0.1:8010?token=' + token)
        return this.socket
    }
    
}

const socket = new Socket()

export default socket